﻿// <copyright file="ColorTypeConverter.cs" company="Marcin Wosik">
// Copyright (c) 2010 All Right Reserved
// </copyright>
// <author>Marcin Wosik</author>
// <email>mawo11@gmail.com</email>
// <date>2010-02-25</date>
// <summary></summary>
namespace GameOfLife.Controls
{
    using System.Globalization;
    using System.Windows.Data;
    using GameOfLife.GameData;

    public sealed class ColorTypeConverter : IValueConverter
    {
        #region Methods

        public object Convert(object value, System.Type targetType, object parameter, CultureInfo culture)
        {
            return new DataItem<ColorMode>(string.Empty, (ColorMode)value);
        }

        public object ConvertBack(object value, System.Type targetType, object parameter, CultureInfo culture)
        {
            DataItem<ColorMode> item = value as DataItem<ColorMode>;
            if (item == null)
            {
                return ColorMode.Default;
            }
            return item.DataItemType;
        }

        #endregion Methods
    }
}